import React, { Component } from 'react'
import "./productSignup.scss"
import Header from '../../components/Header/header'
import Footer from '../../components/Footer/footer';
import { message , Cascader , TreeSelect , Spin } from 'antd'
import district from '../../components/city.js'

import { getApiCategoryList , getApiSend , getApiMobileCheck , getApisetData   , getApiUpload , getApiActivityForm , getApisetSignInfo , getApigetSignInfo , getApieditSignInfo } from "../../axios/api"
import { get, remove , UrlSearch } from '../../axios/localstorage';
const { TreeNode } = TreeSelect;
export default class productSignup extends Component {

    state = {

        iptData:{},

        id:"",
        sid:"",

        showSpin:false,
        showAlert:false,
        type:"0",
        sAlert:false,
        phone:"",
        area:"",
        code:"",
        industry:[],
        industryData:{},
        companyData:{},
        showIndustry:false,
        industryList:['测试1','测试2','测试3','测试4','测试5'],
        demand:[],
        showDemand:false,
        demandData:{},
        company:[],
        stage:[],
        treeValue: undefined,
        treeValue2: undefined,
        
        studyAbroad:"是",
        showStudyAbroad:false,
        studyAbroadList:["是","否"],

        showMsg:false,
        msg:'',
        showSave:false,
        teamIndex:0,
        team:[],
        teamList:[],
        teamData:{name:"",position:"",mobile:"",education:"",age:"",shares:"",email:"",study:"",duty:"",show:false},
        teamArry:[
            {label:"专科及以下人数",value:""},
            {label:"本科人数",value:""},
            {label:"硕士人数",value:""},
            {label:"博士人数",value:""},
            {label:"千人计划",value:""},
            {label:"省级以上科技领军人才计划",value:""},
            {label:"教授",value:""},
            {label:"海外人才",value:""},
            {label:"组织架构",value:""},
            {label:"股权安排",value:""},
        ],

        value:"",

        countDownNum:60,  
        isSend: false,
        alert:false,

        data:{},
        ccc:[],
        demandList:[
            {label: "新一代信息技术产业",value: 20},
            {label: "新2代信息技术产业",value: 21},
            {label: "新3代信息技术产业",value: 22},
            {label: "新4代信息技术产业",value: 23},
            {label: "新5代信息技术产业",value: 24},
        ],

        arr:[],
        array:[],
        aIndex:0,
        selectList:[],

        property:"",
        propertyType:0,
        showProperty:false,
        propertyList:[{title:"专利权",type:1},{title:"著作权",type:2},{title:"商标权",type:3}],
        propertyArray:{
            list:[],
            list2:[],
            list3:[],
            value:"",
        },

        propertyData:{name:"",list:[]},
        propertyData1:{name:"专利权",list:[{label:"类型名称",value:""},{label:"专利名称",value:""},{label:"专利授权号",value:""},{label:"专利授权日",value:""},{label:"附件",value:"",valueList:[]}]},
        propertyData2:{name:"著作权",list:[{label:"登记号",value:""},{label:"专利名称",value:""},{label:"附件",value:"",valueList:[]}]},
        propertyData3:{name:"商标权",list:[{label:"商标授权号",value:""},{label:"商标授权日",value:""},{label:"附件",value:"",valueList:[]}]},

        productArray:[],
        productData:[{label:"产品描述",value:""},{label:"核心技术",value:""},{label:"研发投入",list:[{value:""},{value:""},{value:""}]},{label:"销售收入",list:[{value:""},{value:""},{value:""}]},{label:"未来产品规划",value:""},{label:"营销策略及规划",value:""}],
        productYear:[],



        file:[],
        fileName:[],
    }

    componentWillMount(){

        // getApiDemo()
        // .then( req =>{
        //     if(req.data.code === 1){

        //     }
        // }).catch( err =>{
        //     console.error(err);
        // })



        let ccc = [];

        for(var i=0;i<district.length;i++){
            ccc = ccc.concat(district[i].children)
        }
        this.setState({
            city:district,
            ccc
        })

        

        

        let id = UrlSearch('id');
        let sign_id = UrlSearch('sign_id');
        let sid = UrlSearch('sign_id');

        this.setState({
            id,
            sid
        })

        let param = {
            token:get('token'),
            id:id,
            sign_id,
            type:get('type')?get('type'):0,
            content:get('city')?get('city'):get('mechanism'),
        }


        getApiActivityForm(param)
        .then( req =>{
            if(req.data.code === 1){
                let data = req.data.data;

                this.setState({
                    arr:data,
                    array:data[0].array,
                    aIndex:0,
                    type:data[0].model_info.type?data[0].model_info.type:""
                })

                setTimeout(()=>{
                    this.getData();
                },100)
            }else{
                message.info(req.data.msg);
            }
        }).catch( err =>{
            console.error(err);
        })

    }

    getDataInput=()=>{
        let array = this.state.array;

        for(var i=0;i<array.length;i++){
            if(array[i].list){
                for(var j=0;j<array[i].list.length;j++){
                    if(array[i].list[j].type === "input" || array[i].list[j].type === "text"){
                        this.refs[array[i].list[j].name].value = array[i].list[j].value;
                    }
                }
            }
        }

    }

    getData=()=>{
        let param = {
            id:this.state.sid?this.state.sid:this.state.id,
            token:get('token'),
            type:this.state.sid?1:0,
            types:get('type')?get('type'):0,
            content:get('city')?get('city'):get('mechanism'),
        }

        // console.log(param)

        getApigetSignInfo(param)
        .then( req =>{
            if(req.data.code === 1){
                let data = req.data.data;
                this.setState({
                    arr:data,
                    array:data[0].array,
                    aIndex:0,
                    type:data[0].model_info.type?data[0].model_info.type:""
                })

                console.log(data);

                setTimeout(()=>{
                    this.getDataInput();
                },100)
            }else{
                setTimeout(()=>{
                    this.getDataInput();
                },100)
            }
        }).catch( err =>{
            console.error(err);
        })
    }
    
    saveData=(type)=>{

        if(!get('token')){
            message.info("请先登录！")
            return false;
        }
        
        let arr = this.state.arr;
        let aIndex = this.state.aIndex;
        let info = arr[aIndex].model_info;
        let array = this.state.array;

        if(info.type === "0"){


            arr[aIndex].array = array;

            for(var i=0;i<array.length;i++){
                for(var j=0;j<array[i].list.length;j++){
                    if(array[i].list[j].required === "1" && !array[i].list[j].value){
                        message.info("请先填写必填项！");
                        return false;
                    }
                }
            }

        }else if(info.type === "1"){

            arr[aIndex].array = {productArray:this.state.productArray};

        }else if(info.type === "2"){

            arr[aIndex].array = {propertyArray:this.state.propertyArray}

        }else if(info.type === "3"){

            arr[aIndex].array = {team:this.state.team,teamArray:this.state.teamArry}

        }

        console.log(arr);

        let param = {
            form:arr,
            token:get('token'),
            id:this.state.id,
            type:type,
            types:get('type')?get('type'):0,
        }

        getApisetSignInfo(param)
        .then( req =>{
            if(req.data.code === 1){
                if(type){
                    this.setState({
                        showAlert:true
                    })
                    // message.success("提交成功");
                    // // this.gotoPage("/myapply");
                    // window.history.go(-1);
                }else{
                    message.success("保存成功");
                }
            }else{
                message.info(req.data.msg);
            }
        }).catch( err =>{
            console.error(err)
        })

        
    }
    
    editData=()=>{
        
        let arr = this.state.arr;
        let aIndex = this.state.aIndex;
        let info = arr[aIndex].model_info;
        let array = this.state.array;

        if(info.type === "0"){


            arr[aIndex].array = array;



        }else if(info.type === "1"){

            arr[aIndex].array = {productArray:this.state.productArray};

        }else if(info.type === "2"){

            arr[aIndex].array = {propertyArray:this.state.propertyArray}

        }else if(info.type === "3"){

            arr[aIndex].array = {team:this.state.team,teamArray:this.state.teamArry}

        }

        console.log(arr);

        let param = {
            form:arr,
            token:get('token'),
            id:this.state.id,
            sign_id:this.state.sid,
            type:get('type')?get('type'):0,
            // content:get('city')?get('city'):get('mechanism'),
        }

        console.log(param);

        getApieditSignInfo(param)
        .then( req =>{
            if(req.data.code === 1){
                message.success("编辑成功");
                this.gotoPage("/myactivity");
            }else{
                message.info(req.data.msg);
            }
        }).catch( err =>{
            console.error(err)
        })

        
    }

    gotoPage=(page)=>{
        this.props.history.push(page);
    }

    getSelectData=(index,num,i)=>{

        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;

        getApiCategoryList({field:i.field})
        .then( req =>{
            if(req.data.code === 1){
                let data = req.data.data;
                array[index].list[num].valueList = data;
                arr[aIndex].array = array;

                console.log(array);
                console.log(arr);

                this.setState({
                    arr,
                    array
                })
            }
        }).catch(err =>{
            console.error(err);
        })
    }

    onChangeTree = (treeValue,index,num) => {
        console.log(treeValue);
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;

        array[index].list[num].valueTree = treeValue;
        array[index].list[num].value = treeValue.join(',');
        arr[aIndex].array = array;

        console.log()

        this.setState({
            arr,
            array
        })
    };

      onChangeTree2 = treeValue => {
        console.log(treeValue);
        let data = this.state.data;
        data.ground_city = treeValue;
        
        this.setState({ 
            treeValue2:treeValue,
            data
         });
      };

    onChange2=(value,selectedOptions,index,num) =>{
        console.log(value);
        console.log(value.length);
        console.log(selectedOptions);


        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;

        let options = selectedOptions;

        let str = options[value.length - 1]['label'];

        console.log(str);
    
        array[index].list[num].value = str;
        arr[aIndex].array = array;

        this.setState({
            arr,
            array
        })
    }

    onChange3=(value,selectedOptions,index,num) =>{
        console.log(value);
        console.log(value.length);
        console.log(selectedOptions);

        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;

        let options = selectedOptions;

        let str = options[value.length - 1]['title'];

        console.log(str);
    
        array[index].list[num].value = str;
        arr[aIndex].array = array;

        this.setState({
            arr,
            array
        })
    }

    onChange=(value,selectedOptions,index,num) =>{
        console.log(value);
        //console.log(selectedOptions);
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;
    
        let options = selectedOptions;
    
        let str = ''
    
        for(var i=0;i<options.length;i++){
          str = str+options[i]['label'];
        }
    
        console.log(str);

        array[index].list[num].value = str;
        arr[aIndex].array = array;

        this.setState({
            arr,
            array
        })
        
    }

    gotoNext=()=>{
        window.scroll(0,0)

        if(!get('token')){
            message.info("请先登录！")
            return false;
        }
        let arr = this.state.arr;
        let aIndex = this.state.aIndex;
        let info = arr[aIndex].model_info;
        let array = this.state.array;

        console.log(aIndex);

        console.log(array);

        if(aIndex+1 >= this.state.arr.length){
            if(this.state.sid){
                this.editData();
            }else{
                this.saveData(1);
            }
            
            return false;
        }

        if(info.type === "0"){


            arr[aIndex].array = array;

            

            for(var i=0;i<array.length;i++){
                for(var j=0;j<array[i].list.length;j++){

                    if(array[i].list[j].type !== "checkbox"){
                        if(array[i].list[j].required === "1" && !array[i].list[j].value){
                            message.info("请先填写必填项！");
                            return false;
                        }
                    }

                   
                }
            }
  

        }else if(info.type === "1"){

            arr[aIndex].array = {productArray:this.state.productArray};

        }else if(info.type === "2"){

            arr[aIndex].array = {propertyArray:this.state.propertyArray}

        }else if(info.type === "3"){

            arr[aIndex].array = {team:this.state.team,teamArray:this.state.teamArry}

        }

        let ninfo = arr[aIndex+1].model_info;
        

        if(ninfo.type === "0"){


            array = arr[aIndex+1].array;



        }else if(ninfo.type === "1"){

            array = arr[aIndex+1].array;



            this.setState({
                productYear : ninfo.value
            })

            if(arr[aIndex+1].array.productArray){
                this.setState({
                    productArray:arr[aIndex+1].array.productArray?arr[aIndex+1].array.productArray:[]
                })
            }

        }else if(ninfo.type === "2"){

            array = arr[aIndex+1].array;

            

            if(arr[aIndex+1].array.propertyArray){
                this.setState({
                    propertyArray:{
                        list:arr[aIndex+1].array.propertyArray.list?arr[aIndex+1].array.propertyArray.list:[],
                        list2:arr[aIndex+1].array.propertyArray.list2?arr[aIndex+1].array.propertyArray.list2:[],
                        list3:arr[aIndex+1].array.propertyArray.list3?arr[aIndex+1].array.propertyArray.list3:[]
                    }
                })
            }
            

        }else if(ninfo.type === "3"){

            array = arr[aIndex+1].array;

            if(arr[aIndex+1].array.teamArray){
                this.setState({
                    teamArry:arr[aIndex+1].array.teamArray?arr[aIndex+1].array.teamArray:[],
                    team:arr[aIndex+1].array.team?arr[aIndex+1].array.team:[],
                })
            }

        }



        let ndata = arr[aIndex+1];


        this.setState({
            type:ndata.model_info.type?ndata.model_info.type:"",
            array:array,
            aIndex:aIndex+1
        })

        
        setTimeout(()=>{
            this.getDataInput();
        },100)
       
    }

    gotoPrev=()=>{
        window.scroll(0,0)
        let arr = this.state.arr;
        let aIndex = this.state.aIndex;
        let info = arr[aIndex].model_info;
        let array = this.state.array;


        if(info.type === "0"){


            arr[aIndex].array = array;

            for(var i=0;i<array.length;i++){
                for(var j=0;j<array[i].list.length;j++){
                    if(array[i].list[j].required === "1" && array[i].list[j].type !== "select" && !array[i].list[j].value){
                        message.info("请先填写必填项！");
                        return false;
                    }
                }
            }



        }else if(info.type === "1"){

            arr[aIndex].array = {productArray:this.state.productArray};

        }else if(info.type === "2"){

            arr[aIndex].array = {propertyArray:this.state.propertyArray}

        }else if(info.type === "3"){

            arr[aIndex].array = {team:this.state.team,teamArray:this.state.teamArry}

        }

        let ninfo = arr[aIndex-1].model_info;
        

        if(ninfo.type === "0"){


            array = arr[aIndex-1].array;



        }else if(ninfo.type === "1"){

            array = arr[aIndex-1].array;



            this.setState({
                productYear : ninfo.value
            })

            if(arr[aIndex+1].array.productArray){
                this.setState({
                    productArray:arr[aIndex-1].array.productArray?arr[aIndex-1].array.productArray:[]
                })
            }

        }else if(ninfo.type === "2"){

            array = arr[aIndex-1].array;

            

            if(arr[aIndex+1].array.propertyArray){
                this.setState({
                    propertyArray:{
                        list:arr[aIndex-1].array.propertyArray.list?arr[aIndex-1].array.propertyArray.list:[],
                        list2:arr[aIndex-1].array.propertyArray.list2?arr[aIndex-1].array.propertyArray.list2:[],
                        list3:arr[aIndex-1].array.propertyArray.list3?arr[aIndex-1].array.propertyArray.list3:[]
                    }
                })
            }
            

        }else if(ninfo.type === "3"){

            array = arr[aIndex-1].array;

            if(arr[aIndex-1].array.teamArray){
                this.setState({
                    teamArry:arr[aIndex -1].array.teamArray?arr[aIndex-1].array.teamArray:[],
                    team:arr[aIndex - 1].array.team?arr[aIndex-1].array.team:[],
                })
            }

        }


        // let aIndex = this.state.aIndex + 1;
        // let arr = this.state.arr;
        // let array = this.state.array;

        let ndata = arr[aIndex - 1];


        this.setState({
            type:ndata.model_info.type?ndata.model_info.type:"",
            array:array,
            aIndex:aIndex-1
        })

        setTimeout(()=>{
            this.getDataInput();
        },100)
       
    }

    gotoNext2=(type)=>{

        let data = this.state.data;
        console.log(data);
        
        if(type === 2){

            if(!data.company){
                message.info("请先输入企业名称")
                return false;
            }

            if(!data.city){
                message.info("请先选择所在城市")
                return false;
            }

            if(!data.info){
                message.info("请先输入产品简介")
                return false;
            }

            if(!data.history){
                message.info("请先输入发展历史")
                return false;
            }

            if(!data.realm){
                message.info("请先选择技术领域")
                return false;
            }

            if(!data.company_ress){
                message.info("请先输入企业地址")
                return false;
            }
            if(!data.company_num){
                message.info("请先输入企业人数")
                return false;
            }
           

            if(!data.type_ids){
                message.info("请先选择企业类型")
                return false;
            }

            if(this.state.companyData.name){
                if(!data.type_text){
                    message.info("请先输入选择其他必填项")
                    return false;
                }
            }

            if(!data.business){
                message.info("请先输入主营业务 ")
                return false;
            }
            if(!data.company_name){
                message.info("请先输入联系人姓名")
                return false;
            }
            if(!data.company_mobile){
                message.info("请先输入联系人电话")
                return false;
            }
            if(!data.company_email){
                message.info("请先输入联系人邮箱")
                return false;
            }

            if(!data.financing_stage){
                message.info("请先选择融资阶段")
                return false;
            }

            if(!data.financing_demand){
                message.info("请先输入融资需求")
                return false;
            }

            if(!data.ownership){
                message.info("请先输入股权结构")
                return false;
            }

        }

        if(type === 3){
            if(!data.business_model){
                message.info("请先输入商业模式")
                return false;
            }

            if(!data.sale){
                message.info("请先输入目标市场销售情况")
                return false;
            }
        }

        if(type === 4){
            if(this.state.team.length === 0){
                message.info("请先添加管理团队")
                return false;
            }else{
                let data = this.state.data;
                data.team = this.state.team;
            }
        }

        this.setState({
            type
        })
        window.scroll(0,0);
    }

    chooseCompany=(index)=>{
        let company = this.state.company;
        company[index].chosen = !company[index].chosen;
        this.setState({
            company,
            companyData:{},
        })


        this.countComapnyIds();
    }

    chooseStage=(index,num,n,data)=>{
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;
        array[index].list[num].value = '1';
        if(data.value === "1"){
            array[index].list[num].list[n].value = "0";
            
        }else{
            array[index].list[num].list[n].value = "1";
        }

        arr[aIndex].array = array;

        console.log(array);

        this.setState({
            array,
            arr
        })
    }

    changeOtherStage=(event,index,num,n)=>{
        let value = event.target.value;
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;
        array[index].list[num].list[n].text = value;
        array[index].list[num].list[n].value = "1";
        arr[aIndex].array = array;

        console.log(array);

        this.setState({
            array,
            arr
        })
    }


    gotoEdit=(index)=>{

        this.setState({
            teamData:JSON.parse(JSON.stringify(this.state.team[index])),
            showSave:true,
            teamIndex:index,
        })
    }

    gotoEditProperty=(index,type)=>{

        let propertyArray = this.state.propertyArray;
        let list =[];

        if(type === 1){
            list = propertyArray.list;
        }else if(type === 2){
            list = propertyArray.list2;
        }else{
            list = propertyArray.list3;
        }

        console.log(list);

        this.setState({
            propertyData:JSON.parse(JSON.stringify(list[index])),
            file:list[index].list[list[index].list.length - 1].valueList,
            showSave:true,
            propertyType:type,
            property:list[index].name,
            teamIndex:index
        })
    }

    gotoSaveProperty=(index)=>{
        let propertyArray = this.state.propertyArray;
        let type = this.state.propertyType;

        if(type === 1){
            propertyArray.list[index] = this.state.propertyData;
        }else if(type === 2){
            propertyArray.list2[index] = this.state.propertyData;
        }else{
            propertyArray.list3[index] = this.state.propertyData;
        }

        this.setState({
            propertyArray,
            propertyData:{name:"",list:[]},
            propertyData1:{name:"专利权",list:[{label:"类型名称",value:""},{label:"专利名称",value:""},{label:"专利授权号",value:""},{label:"专利授权日",value:""},{label:"附件",value:"",valueList:[]}]},
            propertyData2:{name:"著作权",list:[{label:"登记号",value:""},{label:"专利名称",value:""},{label:"附件",value:"",valueList:[]}]},
            propertyData3:{name:"商标权",list:[{label:"商标授权号",value:""},{label:"商标授权日",value:""},{label:"附件",value:"",valueList:[]}]},
            file:[],
            propertyType:"",
            property:"",
            showSave:false,
        })

    }

    gotoDelProperty=(index,type)=>{
        let propertyArray = this.state.propertyArray;

        if(type === 1){
            propertyArray.list.splice(index,1);
        }else if(type === 2){
            propertyArray.list2.splice(index,1);
        }else{
            propertyArray.list3.splice(index,1);
        }

        this.setState({
            propertyArray
        })
    }

    gotoSave=(index)=>{
        let team = this.state.team;
        let teamList = this.state.teamList;
        team[index] = this.state.teamData;
        teamList[index] = this.state.teamData;

        
        this.setState({
            team,
            teamList,
            studyAbroad:"",
            showSave:false,
            teamData:{name:"",position:"",mobile:"",education:"",age:"",shares:"",email:"",study:"",duty:"",show:false},
        })

        message.success("保存成功");
    }

    gotoDel=(index)=>{
        let team = this.state.team;
        let teamList = this.state.teamList;
        team.splice(index,1);
        teamList.splice(index,1);

        this.setState({
            team,
            teamList
        })

        message.success("删除成功");
    }

    gotoAdd=()=>{

        let data = this.state.teamData;

        if(!data.name){
            message.info("请先输入姓名")
            return false;
        }

        if(!data.position){
            message.info("请先输入职位")
            return false;
        }
        if(!data.mobile){
            message.info("请先输入手机号")
            return false;
        }

        var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;

        if (!myreg.test(data.mobile)) {
            message.info("请输入准确的手机号码")
            return false;
        }
        

        if(!data.education){
            message.info("请先输入学历")
            return false;
        }

        if(!data.age){
            message.info("请先输入年龄")
            return false;
        }

        if(!data.shares){
            message.info("请先输入所占股份")
            return false;
        }

        if(!data.duty){
            message.info("请先输入主要职责")
            return false;
        }

        if(!data.email){
            message.info("请先输入邮箱")
            return false;
        }

        data.show = false;
        let team = this.state.team;
        team.push(data);
        this.setState({
            team,
            studyAbroad:"",
            showSave:false,
            teamData:{name:"",position:"",mobile:"",education:"",age:"",shares:"",email:"",study:"",duty:"",show:false},
        })

        message.success("添加成功");
    }

    gotoAddProperty=()=>{
        let propertyArray = this.state.propertyArray;

        if(this.state.propertyType === 1){
            propertyArray.list.push(this.state.propertyData);
        }else if(this.state.propertyType === 2){
            propertyArray.list2.push(this.state.propertyData);
        }else{
            propertyArray.list3.push(this.state.propertyData);
        }

        console.log(propertyArray);
        
        this.setState({
            propertyArray,
            propertyData:{name:"",list:[]},
            propertyData1:{name:"专利权",list:[{label:"类型名称",value:""},{label:"专利名称",value:""},{label:"专利授权号",value:""},{label:"专利授权日",value:""},{label:"附件",value:"",valueList:[]}]},
            propertyData2:{name:"著作权",list:[{label:"登记号",value:""},{label:"专利名称",value:""},{label:"附件",value:"",valueList:[]}]},
            propertyData3:{name:"商标权",list:[{label:"商标授权号",value:""},{label:"商标授权日",value:""},{label:"附件",value:"",valueList:[]}]},
            propertyType:"",
            property:"",
            file:[]
        })
    }



    countDown=() =>{ 
        let countDownNum = this.state.countDownNum-1;//获取倒计时初始值
        //如果将定时器设置在外面，那么用户就看不到countDownNum的数值动态变化，所以要把定时器存进data里面
        this.timer = setInterval(() => {


            if(countDownNum<=0){
                clearInterval(this.timer);
                this.setState({ countDownNum:60,  isSend: false })
            }else{
                this.setState({
                    countDownNum:(countDownNum--)
                })
            }
        }, 1000);
    }

    gotoSend=()=>{

        // this.setState({
        //     isSend:true
        // })
        // this.countDown();

        if(!this.state.data.mobile){
            this.setState({
                msg:'请先输入手机号！',
                showMsg:true
            })
            return false;
        }

        var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;

        if (!myreg.test(this.state.data.mobile)) {
            this.setState({
                msg:'请输入准确的手机号码！',
                showMsg:true
            })
            return false;
        }

        let event = "check";


        let param = {
            mobile:this.state.data.mobile,
            event
        }

        getApiSend(param)
        .then( req =>{
            console.log(req.data)
            if(req.data.code === 1){
                this.setState({
                    isSend:true
                })
                this.countDown();
            }else{
                this.setState({
                    msg:req.data.msg,
                    showMsg:true
                })
            }
        }).catch( err =>{
            console.error(err);
        })

    }

    gotoCheck=()=>{

        if(!this.state.data.mobile){
            this.setState({
                msg:"请先输入手机号！",
                showMsg:true,
            })

            return false;
        }

        if(!this.state.code){
            this.setState({
                msg:"请先输入验证码！",
                showMsg:true,
            })

            return false;
        }

        let param = {
            mobile:this.state.data.mobile,
            captcha:this.state.code,
        }

        getApiMobileCheck(param)
        .then( req =>{
            if(req.data.code === 1){
                this.gotoPush();
            }else{
                this.setState({
                    showMsg:true,
                    msg:req.datamsg
                })
                // this.gotoPush();
            }
        }).catch( err =>{
            console.error(err);
        })
    }

    gotoPush=()=>{




        let data = this.state.data;
        data.is_check = 1;

        console.log(data);
        getApisetData(data)
        .then( req =>{
            if(req.data.code === 1){
                this.setState({
                    sAlert:true,
                    alert:false
                })
            }
        }).catch( err =>{
            console.error(err);
        })
    }

    changeIptDataValue=(v,index,num)=>{
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;
        array[index].list[num].value = v;
        arr[aIndex].array = array;

        this.setState({
            array,
            arr,
            
        })
    }

    changeDataValue=(ev,index,num)=>{
        let value = ev.target.value;
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;
        array[index].list[num].value = value;
        arr[aIndex].array = array;
        console.log(value);
        this.setState({
            array,
            arr,
            
        })
    }

    changeDataProductValue=(ev,index,type,num)=>{
        let value = ev.target.value;
        let productData = this.state.productData;
        if(type === 0){
            productData[index].value = value;
        }else{
            productData[index].list[num].value = value;
        }

        this.setState({
            productData  
        })
    }

    gotoEditProduct=(index)=>{

        let list = this.state.productArray
        
        this.setState({
            productData:JSON.parse(JSON.stringify(list[index])),
            teamIndex:index,
            showSave:true
        })
    }

    gotoDelProduct=(index)=>{
        let productArray = this.state.productArray
        productArray.splice(index,1);
        
        this.setState({
            productArray
        })
    }

    gotoSaveProduct=(index)=>{

        let productArray = this.state.productArray

        let productData = this.state.productData;

        for(var i=0;i<productData.length;i++){
            if(!productData[i].list){

                if(!productData[i].value){
                    message.info("请先输入"+productData[i].label)
                    return false;
                }
            }
        }

        productArray[index] = productData;
        
        this.setState({
            productArray,
            showSave:false,
            productData:[{label:"产品描述",value:""},{label:"核心技术",value:""},{label:"研发投入",list:[{value:""},{value:""},{value:""}]},{label:"销售收入",list:[{value:""},{value:""},{value:""}]},{label:"未来产品规划",value:""},{label:"营销策略及规划",value:""}],
        
        })
    }

    gotoAddProduct=()=>{

        let productData = this.state.productData;

        for(var i=0;i<productData.length;i++){
            if(!productData[i].list){

                if(!productData[i].value){
                    message.info("请先输入"+productData[i].label)
                    return false;
                }
            }
        }

        let productArray = this.state.productArray;
        productArray.push(productData);

        this.setState({
            productArray,
            productData:[{label:"产品描述",value:""},{label:"核心技术",value:""},{label:"研发投入",list:[{value:""},{value:""},{value:""}]},{label:"销售收入",list:[{value:""},{value:""},{value:""}]},{label:"未来产品规划",value:""},{label:"营销策略及规划",value:""}],
        
        })
    }

    changeDataValueStr=(ev,index,num,str)=>{
        let value = ev.target.value;
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;
        array[index].list[num].list[str] = value;
        arr[aIndex].array = array;

        console.log(array);

        this.setState({
            array,
            arr
        })
    }

    changeTeamDataValue=(ev,name)=>{
        let value = ev.target.value;
        let teamData = this.state.teamData;
        teamData[name] = value;
        this.setState({
            teamData
        })

        console.log(this.state.team)
        console.log(this.state.teamList)
    }

    changePropertyValue=(ev,index)=>{
        let value = ev.target.value;

        let data = this.state.propertyData;

        data.list[index].value = value;

        this.setState({
            propertyData:data
        })
    }

    changeYearValue=(ev,name,index)=>{
        let value = ev.target.value;
        let year = this.state.year;
        year[index][name] = value;
        this.setState({
            year
        })
    }


    changeTeamValue=(ev,index)=>{
        let value = ev.target.value;
        let teamArry = this.state.teamArry;
        teamArry[index].value = value;
        this.setState({
            teamArry
        })
    }

    gotoLoad=(event,index,num)=>{

        this.setState({
            showSpin:true
        })

        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;


        let file = event.target.files[0];
        console.log(file);
        let name = file.name;;
        console.log(name);
        let fd = new FormData()
    
        fd.append('file', file)
        fd.append('token', get('token'));
        // fd.append('type',2);

        getApiUpload(fd)
        .then( req =>{
            console.log(req.data);
            if(req.data.code === 1){

                

                let data = req.data.data;

                let url = data.url

                let valueTree = array[index].list[num].valueTree?array[index].list[num].valueTree:[];
                let valueName = array[index].list[num].valueName?array[index].list[num].valueName:[];

                valueTree.push(url);
                valueName.push(name);

                console.log(valueTree);

                array[index].list[num].valueTree = valueTree;
                array[index].list[num].valueName = valueName;
                array[index].list[num].value = valueTree.join(',');
                arr[aIndex].array = array;

                this.setState({
                    array,
                    arr,
                    showSpin:false,
                })
            }else{
                this.setState({
                    showSpin:false
                })
                message.info(req.data.msg);
            }
        }).catch( err =>{
            console.error(err)
        })

    }
    gotoLoadProperty=(event)=>{

        let property = this.state.propertyData;
        let fileArr = this.state.file;
        let fileName = this.state.fileName;

        let file = event.target.files[0];
        console.log(file);
        let name = file.name;

        let fd = new FormData()
    
        fd.append('file', file)
        fd.append('token', get('token'));
        // fd.append('type',2);

        getApiUpload(fd)
        .then( req =>{
            console.log(req.data);
            if(req.data.code === 1){

                

                let data = req.data.data;

                let url = data.url;

                fileArr.push(url);
                fileName.push(name);

                property.list[property.list.length - 1].valueList = fileArr;
                property.list[property.list.length - 1].valueName = fileName;
                property.list[property.list.length - 1].value = fileArr.join(',');

                console.log(property);

                this.setState({
                    file:fileArr,
                    propertyData:property,
                    fileName
                })


            }
        }).catch( err =>{
            console.error(err)
        })

    }

    delFile=(index,num,n)=>{
        let aIndex = this.state.aIndex;
        let arr = this.state.arr;
        let array = this.state.array;

        array[index].list[num].valueName.splice(n,1);
        arr[aIndex].array = array;

        this.setState({
            array,
            arr
        })
    }

    delFileProperty=(index)=>{
        let file = this.state.file;
        file.splice(index,1);
        let property = this.state.propertyData;

        property.list[property.list.length - 1].valueList = file;
        property.list[property.list.length - 1].value = file.join(',');

        console.log(property);

        this.setState({
            file,
            propertyData:property
        })
    }

    gotoShowAlert=()=>{

        let data = this.state.data;

        if(!data.product_info){
            message.info("请先输入产品描述");
            return false;
        }

        this.setState({
            alert:true
        })
    }

    render() {
        return (
            <div className="productSignup">
                <Header />
                <div className="stypes">
                    <div className='sm'>
                        <div className="cleft">
                            <img className="img" alt="" src="assets/imgs/dingwei.png" />
                            <p className="p_point" onClick={()=>{
                                if(get('type')){
                                    this.gotoPage('/index')
                                    }else{
                                    this.gotoPage('/home')
                                    }
                            }}>首页</p>
                            <img className="icon" alt="" src="assets/img/xiaji.png" />
                            <p className="p_point" onClick={()=>{this.gotoPage('/signup')}}>活动报名</p>
                            <img className="icon" alt="" src="assets/img/xiaji.png" />
                            <p className="p_point" onClick={()=>{this.gotoPage('/signupinfo?id='+this.state.id)}}>活动详情</p>
                            <img className="icon" alt="" src="assets/img/xiaji.png" />
                            <p>提交信息</p>
                        </div>
                    </div>
                   <div className='sm'>
                        <div className="smain">
                            {
                                this.state.arr.map((item,index)=>{
                                    return <div className="smi" key={index}>
                                                <div className={this.state.type >= 1?"sitem":"sitem"}>
                                                    <div className="sdiv">
                                                        <img className="simg1" alt="" src="assets/img/chanyejishuchuangxinlianmeng1.png" />
                                                    </div>
                                                    <p>{item.model_info.title}</p>
                                                </div>
                                                <div className="saa">
                                                    <img alt="" src="assets/img/xiaji.png" />
                                                </div>
                                            </div>
                                })
                            }
                        </div>
                   </div>
                </div>
                <div className="sp2">
                    {
                        this.state.type === "0"?<div className="cen">
                        <div className="smain">
                            
                            {
                                this.state.array.map((item,index)=>{
                                    return <div className="smi" key={index}>
                                                <div className="sname">
                                                    <div></div>
                                                    <p>{item.title}</p>
                                                </div>
                                                <div className="sbox">
                                                    {
                                                        item.list.map((elem,num)=>{
                                                            return <div key={num} className="spage">
                                                                        
                                                                        <div hidden={elem.type !== 'input' && elem.type !== 'text'}>
                                                                            <div className="sitem">
                                                                                <div className="stitle">
                                                                                    <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                    <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                                </div>
                                                                                {/* <InputBtn name={elem.name} index={index} num={num} value={elem.value} changeIptDataValue={this.changeIptDataValue} /> */}
                                                                                <input ref={elem.name} className="s_input" type="text" placeholder="" onBlur={(ev)=>{this.changeDataValue(ev,index,num,elem)}}  />
                                                                                {/* <Input placeholder="" value={elem.value} onChange={(ev)=>{this.changeDataValue(ev,index,num)}} /> */}
                                                                            </div>
                                                                        </div>

                                                                        <div className="sitem" hidden={elem.type !== 'city'}>
                                                                                <div className="stitle">
                                                                                    <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                    <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                                </div>
                                                                                <div className="sipt">
                                                                                    {elem.value?elem.value:''}
                                                                                    <img alt="" src="assets/imgs/xiala.png" />
                                                                                    <div className="casDiv"><Cascader style={{borderColor:'#fff',flex:'1',opacity:'0',width:"100%"}} placeholder=' ' size="large" options={this.state.city} onChange={(value,selectedOptions)=>{this.onChange(value,selectedOptions,index,num)}} /></div>
                                                                                </div>
                                                                            </div>

                                                                        <div className={elem.type !== "checkbox"?"snone":"spage"}>
                                                                        <div className="sitem">
                                                                            <div className="smore">
                                                                                <div className="stitle">
                                                                                    <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                    <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                                </div>
                                                                                <div className="smbox">
                                                                                    {
                                                                                        elem.type === "checkbox"?elem.list.map((i,n)=>{
                                                                                            return <div key={n}>
                                                                                                        <div hidden={i.title === "其他"} className="smi" onClick={()=>{this.chooseStage(index,num,n,i)}}>
                                                                                                            <div className={i.value === "1"?"sm_chosen":""}><span></span></div>
                                                                                                            <h4>{i.title}</h4>
                                                                                                        </div>
                                                                                                        <div hidden={i.title !== "其他"} className="smi" onClick={()=>{this.chooseStage(index,num,n,i)}}>
                                                                                                            <div className={i.value === "1"?"sm_chosen":""}><span></span></div>
                                                                                                            <h4>其他</h4>
                                                                                                            <h2 onClick={(ev)=>{ev.stopPropagation()}}>
                                                                                                                <input type="text" placeholder="选择其他时填写" value={i.text} onChange={(ev)=>{this.changeOtherStage(ev,index,num,n)}} />
                                                                                                            </h2>
                                                                                                        </div>
                                                                                                    </div>
                                                                                        }):null
                                                                                    }
                                                                                    
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                        </div>

                                                                        <div className={elem.type !== "table" || num === 0?"snone":"spage"}>
                                                                            <div className="sflex">
                                                                                <div className="sitem sw1">
                                                                                    <div className="stitle">
                                                                                        <p>{item.list[0].list.value1}{elem.name} </p>
                                                                                        <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                                    </div>
                                                                                    <input className="s_input" type="text" placeholder="" value={elem.list.value1} onChange={(ev)=>{this.changeDataValueStr(ev,index,num,"value1")}} />
                                                                                </div>
                                                                                <div className="sitem sw1">
                                                                                    <div className="stitle">
                                                                                        <p>{item.list[0].list.value2}{elem.name} </p>
                                                                                        <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                                    </div>
                                                                                    <input className="s_input" type="text" placeholder="" value={elem.list.value2} onChange={(ev)=>{this.changeDataValueStr(ev,index,num,"value2")}} />
                                                                                </div>
                                                                                <div className="sitem sw1">
                                                                                    <div className="stitle">
                                                                                        <p>{item.list[0].list.value3}{elem.name}</p>
                                                                                        <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                                    </div>
                                                                                    <input className="s_input" type="text" placeholder="" value={elem.list.value3} onChange={(ev)=>{this.changeDataValueStr(ev,index,num,"value3")}} />
                                                                                </div>
                                                                            </div>
                                                                        </div>

                                                                        <div className={elem.type !== 'citys'?"snone":"spage"}>
                                                                        <div className="sitem">
                                                                            <div className="stitle">
                                                                                <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                            </div>
                                                                            <div className="sii">
                                                                                <TreeSelect
                                                                                    showSearch={true}
                                                                                    dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                                                                                    value={elem.valueTree}
                                                                                    allowClear
                                                                                    multiple
                                                                                    treeDefaultExpandAll
                                                                                    placeholder="选择其他相关城市"
                                                                                    size="large"
                                                                                    style={{borderColor:'#fff',flex:'1',width:"100%",height:"auto"}}
                                                                                    onChange={(treeValue)=>{this.onChangeTree(treeValue,index,num)}}
                                                                                >
                                                                                    {
                                                                                        this.state.ccc.map((item,index)=>{
                                                                                            return <TreeNode value={item.label} title={item.label}>
                                                                                                    </TreeNode>
                                                                                        })
                                                                                    }
                                                                                </TreeSelect>
                                                                            </div>
                                                                        </div>
                                                                        </div>

                                                                        <div className="sitem" hidden={elem.type !== "selectpage"}>
                                                                            <div className="stitle">
                                                                                <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                            </div>
                                                                            <div className="sipt" onClick={()=>{this.getSelectData(index,num,elem)}}>
                                                                                {elem.value?elem.value:''}
                                                                                <img alt="" src="assets/imgs/xiala.png" />
                                                                                <div className="casDiv"><Cascader value={this.state.value2}  style={{borderColor:'#fff',flex:'1',opacity:'0',width:"100%"}} placeholder=' ' size="large" options={elem.valueList?elem.valueList:[]} onChange={(value,selectedOptions)=>{this.onChange2(value,selectedOptions,index,num)}} /></div>
                                                                            </div>
                                                                        </div>

                                                                        <div className="sitem" hidden={elem.type !== "select"}>
                                                                            <div className="stitle">
                                                                                <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                            </div>
                                                                            <div className="sipt">
                                                                                {elem.value?elem.value:''}
                                                                                <img alt="" src="assets/imgs/xiala.png" />
                                                                                <div className="casDiv"><Cascader  style={{borderColor:'#fff',flex:'1',opacity:'0',width:"100%"}} placeholder=' ' size="large" options={elem.list?elem.list:[]} fieldNames={{ label: 'title', value: 'title' }} onChange={(value,selectedOptions)=>{this.onChange3(value,selectedOptions,index,num)}}  /></div>
                                                                            </div>
                                                                        </div>

                                                                        <div className="s_upload" hidden={elem.type !== "file"}>
                                                                            <div className="stitle">
                                                                                <p>{elem.name} <span hidden={elem.required !== '1'}>*</span></p>
                                                                                <h4>{elem.text?"（"+elem.text+"）":""}</h4>
                                                                            </div>

                                                                            <div className="s_files">
                                                                                <div className="sbtn">
                                                                                    <button>上传附件</button>
                                                                                    <input value="" className='load' onChange={(ev)=>{this.gotoLoad(ev,index,num)}} type="file" accept="*" id="inputFile"  />
                                                                                </div>
                                                                                <div className="sf">
                                                                                    {
                                                                                        elem.valueName?elem.valueName.map((i,n)=>{
                                                                                            return <h4>{i}<img onClick={()=>{this.delFile(index,num,n)}} alt="" src="assets/imgs/tankuangcha.png" /></h4>
                                                                                        }):null
                                                                                    }
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                        })
                                                    }
                                                    
                                                        
                                                </div>
                                    </div>
                                })
                            }

                            <div className="sname" hidden>
                                <div></div>
                                <p>核心管理团队</p>
                            </div>
                            <div className="sbox" hidden>
                                <div className="sitem">
                                    <p>姓名  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.name} onChange={(ev)=>{this.changeTeamDataValue(ev,'name')}} />
                                </div>
                                <div className="sitem">
                                    <p>职位  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.position} onChange={(ev)=>{this.changeTeamDataValue(ev,'position')}} />
                                </div>
                                <div className="sitem">
                                    <p>手机号  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.mobile} onChange={(ev)=>{this.changeTeamDataValue(ev,'mobile')}} />
                                </div>

                                <div className="sitem">
                                    <p>学历  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.education} onChange={(ev)=>{this.changeTeamDataValue(ev,'education')}} />
                                </div>
                                <div className="sitem">
                                    <p>年龄  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.age} onChange={(ev)=>{this.changeTeamDataValue(ev,'age')}} />
                                </div>
                                <div className="sitem">
                                    <p>所占股份   <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.shares} onChange={(ev)=>{this.changeTeamDataValue(ev,'shares')}} />
                                </div>
                                <div className="sitem">
                                    <p>主要职责 <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.duty} onChange={(ev)=>{this.changeTeamDataValue(ev,'duty')}} />
                                </div>
                                <div className="sitem">
                                    <p>邮箱 <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.email} onChange={(ev)=>{this.changeTeamDataValue(ev,'email')}} />
                                </div>
                                <div className="sitem">
                                    <p>是否留学 <span>*</span></p>
                                    <div className="selbox" onClick={()=>{this.setState({showStudyAbroad:!this.state.showStudyAbroad})}} >
                                        {this.state.studyAbroad}
                                        <img alt="" src="assets/imgs/xiala.png" />
                                        <div className="sels" hidden={!this.state.showStudyAbroad} onMouseLeave={()=>{this.setState({showStudyAbroad:false})}}>
                                            {
                                                this.state.studyAbroadList.map((item,index)=>{
                                                    return <h4 key={index} className={this.state.studyAbroad === item?'hover':''} onClick={()=>{
                                                        let teamData = this.state.teamData;
                                                        teamData.study = item === "是"?1:0
                                                        this.setState({studyAbroad:item,teamData})
                                                    }}>{item}</h4>
                                                })
                                            }
                                        </div>
                                    </div>
                                </div>


                                <div className="sname">
                                    <div></div>
                                    <p>已添加人员列表</p>
                                </div>

                                <table>
                                    <tbody>
                                        <tr>
                                            <th>姓名</th>
                                            <th>职位</th>
                                            <th>手机号</th>
                                            <th>学历</th>
                                            <th>年龄</th>
                                            <th>所占股份</th>
                                            <th>邮箱</th>
                                            <th>是否留学</th>
                                            <th>主要职责</th>
                                            <th>操作</th>
                                        </tr>
                                        {
                                           this.state.team.map((item,index)=>{
                                                return <tr>
                                                            <td>{item.name}</td>
                                                            <td>{item.position}</td>
                                                            <td>{item.mobile}</td>
                                                            <td>{item.education}</td>
                                                            <td>{item.age}</td>
                                                            <td>{item.shares}</td>
                                                            <td>{item.email}</td>
                                                            <td>{item.study === 1?"是":"否"}</td>
                                                            <td>{item.duty}</td>
                                                            <td>
                                                                <div className="options">
                                                                    <div className="option" onClick={()=>{this.gotoEdit(index)}}>
                                                                        <img alt="" src="assets/imgs/bianji.png" />
                                                                        <p>编辑</p>
                                                                    </div>
                                                                    <div className="option" onClick={()=>{this.gotoDel(index)}}>
                                                                        <img alt="" src="assets/imgs/shanchu.png" />
                                                                        <h2>删除</h2>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                            })
                                        }
                                        
                                    </tbody>
                                </table>

                            </div>

                            
                        </div>
                        
                    </div>:null
                    }

                    <div className="cen" hidden={this.state.type !== "1"}>
                        <div className="smain">
                            <div className="sname">
                                <div></div>
                                <p>产品概况</p>
                            </div>

                            <div className="sbox">
                                {
                                    this.state.productData.map((item,index)=>{
                                        return <div className="spage">
                                                    <div className="sitem" hidden={item.list}>
                                                        <p>{item.label}</p>
                                                        <input className="s_input" type="text" placeholder="" value={item.value} onChange={(ev)=>{this.changeDataProductValue(ev,index,0)}}/>
                                                    </div>
                                                    <div className="sflex" hidden={!item.list}>
                                                        {
                                                            item.list?item.list.map((elem,num)=>{
                                                                return <div className="sitem sw1">
                                                                            <p>{this.state.productYear[num]}年{item.label}</p>
                                                                            <input className="s_input" type="text" placeholder="" value={elem.value} onChange={(ev)=>{this.changeDataProductValue(ev,index,1,num)}} />
                                                                        </div>
                                                            }):null
                                                        }
                                                    </div>
                                            </div>
                                    })
                                }
                                <div className="sadd">
                                    <button hidden={this.state.showSave} onClick={()=>{this.gotoAddProduct()}}>添加</button>
                                    <button hidden={!this.state.showSave} className="sa2" onClick={()=>{this.gotoSaveProduct(this.state.teamIndex)}}>保存</button>
                                </div>
                                <div className="sitem sw1">
                                </div>
                                <div className="sname">
                                    <div></div>
                                    <p>已添加产品列表</p>
                                </div>

                                <table>
                                    <tbody>
                                        <tr>
                                            <th>产品描述</th>
                                            <th>核心技术</th>
                                            <th className="tw1">未来产品规划</th>
                                            <th className="tw1">营销策略及规划</th>
                                            {
                                                this.state.productYear.map((item,index)=>{
                                                    return <th className="tw1">{item}年研发投入</th>
                                                })
                                            }
                                            {
                                                this.state.productYear.map((item,index)=>{
                                                    return <th className="tw1">{item}年销售收入</th>
                                                })
                                            }
                                            
                                            <th className="tw">操作</th>
                                        </tr>
                                        {
                                           this.state.productArray.map((item,index)=>{
                                                return <tr>
                                                            {
                                                                item.map((elem,num)=>{
                                                                    return <td hidden={elem.list}>
                                                                        {elem.value}
                                                                    </td>
                                                                })
                                                            }
                                                            {
                                                                item.map((elem,num)=>{
                                                                    return elem.list?elem.list.map((i,n)=>{return <td>{i.value}</td>}):null
                                                                })
                                                            }
                                                            <td>
                                                                <div className="options">
                                                                    <div className="option" onClick={()=>{this.gotoEditProduct(index)}}>
                                                                        <img alt="" src="assets/imgs/bianji.png" />
                                                                        <p>编辑</p>
                                                                    </div>
                                                                    <div className="option" onClick={()=>{this.gotoDelProduct(index)}}>
                                                                        <img alt="" src="assets/imgs/shanchu.png" />
                                                                        <h2>删除</h2>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                            })
                                        }
                                        
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        
                    </div>

                    <div className="cen" hidden={this.state.type !== "2"}>
                        <div className="smain">
                            <div className="sname">
                                <div></div>
                                <p>知识产权</p>
                            </div>
                            <div className="sbox">
                                <div className="sitem sw1">
                                    <p>是否有知识产权 <span>*</span></p>
                                    <div className="selbox" onClick={()=>{this.setState({showStudyAbroad:!this.state.showStudyAbroad})}} >
                                        {this.state.studyAbroad}
                                        <img alt="" src="assets/imgs/xiala.png" />
                                        <div className="sels" hidden={!this.state.showStudyAbroad} onMouseLeave={()=>{this.setState({showStudyAbroad:false})}}>
                                            {
                                                this.state.studyAbroadList.map((item,index)=>{
                                                    return <h4 key={index} className={this.state.studyAbroad === item?'hover':''} onClick={()=>{
                                                        this.setState({studyAbroad:item})}}>{item}</h4>
                                                })
                                            }
                                        </div>
                                    </div>
                                </div>
                                <div className="sitem sw1" hidden={this.state.studyAbroad !== "是"}>
                                    <p>知识产权类型 <span>*</span></p>
                                    <div className="selbox" onClick={()=>{this.setState({showProperty:!this.state.showProperty})}} >
                                        {this.state.property}
                                        <img alt="" src="assets/imgs/xiala.png" />
                                        <div className="sels" hidden={!this.state.showProperty} onMouseLeave={()=>{this.setState({showProperty:false})}}>
                                            {
                                                this.state.propertyList.map((item,index)=>{
                                                    return <h4 key={index} className={this.state.property === item.title?'hover':''} onClick={()=>{this.setState({ file:[], fileName:[], showSave:false, property:item.title,propertyType:item.type,propertyData:this.state["propertyData"+item.type]}) }}>{item.title}</h4>
                                                })
                                            }
                                        </div>
                                    </div>
                                </div>
                                <div className="sitem sw1" hidden={this.state.studyAbroad !== "是"}>
                                    <div className="sadd">
                                        <button hidden={this.state.showSave} onClick={()=>{this.gotoAddProperty()}}>添加</button>
                                        <button hidden={!this.state.showSave} className="sa2" onClick={()=>{this.gotoSaveProperty(this.state.teamIndex)}}>保存</button>
                                    </div>
                                </div>

                                <div className="spage" hidden={this.state.studyAbroad !== "是"}>
                                    <div className="spage" hidden={!this.state.property}>
                                        <div className="sname">
                                            <div></div>
                                            <p>{this.state.property}</p>
                                        </div>

                                        <div className="sbox">
                                            {
                                                this.state.propertyData.list.map((item,index)=>{
                                                    return <div className="spage2">
                                                                    <div className="sitem sw1" hidden={item.label === "附件"}>
                                                                        <p>{item.label}</p>
                                                                        <input className="s_input" type="text" placeholder="" value={item.value} onChange={(ev)=>{this.changePropertyValue(ev,index)}} />
                                                                    </div>
                                                                    <div className="sitem sw1" hidden={item.label !== "附件"}>
                                                                    </div>
                                                                    
                                                            </div>
                                                })
                                            }

                                            <div className="sitem">
                                                <div className="s_upload">
                                                    <div className="stitle">
                                                        <p>相关附件</p>
                                                    </div>

                                                    <div className="s_files">
                                                        <div className="sbtn">
                                                            <button>上传附件</button>
                                                            <input value="" className='load' onChange={(ev)=>{this.gotoLoadProperty(ev)}} type="file" accept="*" id="inputFile"  />
                                                        </div>
                                                        <div className="sf">
                                                            {
                                                                this.state.fileName.map((item,index)=>{
                                                                    return <h4>{item}<img onClick={()=>{this.delFileProperty(index)}} alt="" src="assets/imgs/tankuangcha.png" /></h4>
                                                                })
                                                            }
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                    

                                    <div className="sname">
                                        <div></div>
                                        <p>已添加知识产权列表</p>
                                    </div>


                                    

                                   <div className="spage" hidden={this.state.propertyArray.list.length  === 0}>
                                   <h1>专利权</h1>
                                    <table>
                                        <tbody>
                                            <tr>
                                                <th>类型</th>
                                                <th>类型名称</th>
                                                <th>专利名称</th>
                                                <th>专利授权号</th>
                                                <th>专利授权日</th>
                                                <th>操作</th>
                                            </tr>
                                            {
                                            this.state.propertyArray.list.map((item,index)=>{
                                                    return <tr>
                                                                <td>{item.name}</td>
                                                                {
                                                                    item.list.map((elem,num)=>{
                                                                        return <td hidden={elem.label === "附件"}>{elem.value}</td>
                                                                    })
                                                                }
                                                                <td>
                                                                    <div className="options">
                                                                        <div className="option" onClick={()=>{this.gotoEditProperty(index,1)}}>
                                                                            <img alt="" src="assets/imgs/bianji.png" />
                                                                            <p>编辑</p>
                                                                        </div>
                                                                        <div className="option" onClick={()=>{this.gotoDelProperty(index,1)}}>
                                                                            <img alt="" src="assets/imgs/shanchu.png" />
                                                                            <h2>删除</h2>
                                                                        </div>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                })
                                            }
                                            
                                        </tbody>
                                    </table>
                                   </div>

                                   <div className="spage" hidden={this.state.propertyArray.list2.length  === 0}>
                                   <h1>著作权</h1>
                                    <table>
                                        <tbody>
                                            <tr>
                                                <th>类型</th>
                                                <th>登记号</th>
                                                <th>软件全称</th>
                                                <th>操作</th>
                                            </tr>
                                            {
                                            this.state.propertyArray.list2.map((item,index)=>{
                                                    return <tr>
                                                                <td>{item.name}</td>
                                                                {
                                                                    item.list.map((elem,num)=>{
                                                                        return <td hidden={elem.label === "附件"}>{elem.value}</td>
                                                                    })
                                                                }
                                                                <td>
                                                                    <div className="options">
                                                                        <div className="option" onClick={()=>{this.gotoEditProperty(index,2)}}>
                                                                            <img alt="" src="assets/imgs/bianji.png" />
                                                                            <p>编辑</p>
                                                                        </div>
                                                                        <div className="option" onClick={()=>{this.gotoDelProperty(index,2)}}>
                                                                            <img alt="" src="assets/imgs/shanchu.png" />
                                                                            <h2>删除</h2>
                                                                        </div>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                })
                                            }
                                            
                                        </tbody>
                                    </table>
                                   </div>

                                   
                                    <div className="spage" hidden={this.state.propertyArray.list3?this.state.propertyArray.list3.length === 0:0}>
                                    <h1>商标权</h1>
                                    <table>
                                        <tbody>
                                            <tr>
                                                <th>类型</th>
                                                <th>商标授权号</th>
                                                <th>商标授权日</th>
                                                <th>操作</th>
                                            </tr>
                                            {
                                            this.state.propertyArray.list3?this.state.propertyArray.list3.map((item,index)=>{
                                                    return <tr>
                                                                <td>{item.name}</td>
                                                                {
                                                                    item.list.map((elem,num)=>{
                                                                        return <td hidden={elem.label === "附件"}>{elem.value}</td>
                                                                    })
                                                                }
                                                                <td>
                                                                    <div className="options">
                                                                        <div className="option" onClick={()=>{this.gotoEditProperty(index,3)}}>
                                                                            <img alt="" src="assets/imgs/bianji.png" />
                                                                            <p>编辑</p>
                                                                        </div>
                                                                        <div className="option" onClick={()=>{this.gotoDelProperty(index,3)}}>
                                                                            <img alt="" src="assets/imgs/shanchu.png" />
                                                                            <h2>删除</h2>
                                                                        </div>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                }):null
                                            }
                                            
                                        </tbody>
                                    </table>
                                    </div>

                                
                                </div>
                                
                                <div className="sname">
                                    <div></div>
                                    <p>知识产权技术优势分析</p>
                                </div>

                                <div className="sitem">
                                    <p>技术来源  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.propertyArray.value} onChange={(ev)=>{
                                        let value = ev.target.value;
                                        let propertyArray = this.state.propertyArray;
                                        propertyArray.value = value;
                                        this.setState({
                                            propertyArray
                                        })
                                    }} />
                                </div>

                            </div>
                            
                        </div>
                        
                    </div>

                    <div className="cen" hidden={this.state.type !== "3"}>
                        <div className="smain">
                            <div className="sname">
                                <div></div>
                                <p>核心管理团队</p>
                            </div>
                            <div className="sbox">
                                <div className="sitem">
                                    <p>姓名  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.name} onChange={(ev)=>{this.changeTeamDataValue(ev,'name')}} />
                                </div>
                                <div className="sitem">
                                    <p>职位  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.position} onChange={(ev)=>{this.changeTeamDataValue(ev,'position')}} />
                                </div>
                                <div className="sitem">
                                    <p>手机号  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.mobile} onChange={(ev)=>{this.changeTeamDataValue(ev,'mobile')}} />
                                </div>

                                <div className="sitem">
                                    <p>学历  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.education} onChange={(ev)=>{this.changeTeamDataValue(ev,'education')}} />
                                </div>
                                <div className="sitem">
                                    <p>年龄  <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.age} onChange={(ev)=>{this.changeTeamDataValue(ev,'age')}} />
                                </div>
                                <div className="sitem">
                                    <p>所占股份   <span>*</span></p>
                                    <input className="s_input" type="text" placeholder="" value={this.state.teamData.shares} onChange={(ev)=>{this.changeTeamDataValue(ev,'shares')}} />
                                </div>

                                <div className='sright'>
                                    <div className="sitem">
                                        <p>主要职责 <span>*</span></p>
                                        <textarea type="text" placeholder="" value={this.state.teamData.duty} onChange={(ev)=>{this.changeTeamDataValue(ev,'duty')}} />
                                    </div>
                                    <div className="sitem">
                                        <p>邮箱 <span>*</span></p>
                                        <input className="s_input" type="text" placeholder="" value={this.state.teamData.email} onChange={(ev)=>{this.changeTeamDataValue(ev,'email')}} />
                                    </div>
                                </div>

                                <div className="sleft">
                                    <div className="sitem">
                                        <p>是否留学 <span>*</span></p>
                                        <div className="selbox" onClick={()=>{this.setState({showStudyAbroad:!this.state.showStudyAbroad})}} >
                                            {this.state.studyAbroad}
                                            <img alt="" src="assets/imgs/xiala.png" />
                                            <div className="sels" hidden={!this.state.showStudyAbroad} onMouseLeave={()=>{this.setState({showStudyAbroad:false})}}>
                                                {
                                                    this.state.studyAbroadList.map((item,index)=>{
                                                        return <h4 key={index} className={this.state.studyAbroad === item?'hover':''} onClick={()=>{
                                                            let teamData = this.state.teamData;
                                                            teamData.study = item === "是"?1:0
                                                            this.setState({studyAbroad:item,teamData})
                                                        }}>{item}</h4>
                                                    })
                                                }
                                            </div>
                                        </div>
                                    </div>

                                    <div className="sadd">
                                        <button hidden={this.state.showSave} onClick={()=>{this.gotoAdd()}}>添加</button>
                                        <button hidden={!this.state.showSave} className="sa2" onClick={()=>{this.gotoSave(this.state.teamIndex)}}>保存</button>
                                    </div>
                                </div>

                                <div className="sname">
                                    <div></div>
                                    <p>已添加人员列表</p>
                                </div>
                                

                                <table>
                                    <tbody>
                                        <tr>
                                            <th>姓名</th>
                                            <th>职位</th>
                                            <th>手机号</th>
                                            <th>学历</th>
                                            <th>年龄</th>
                                            <th>所占股份</th>
                                            <th>邮箱</th>
                                            <th>是否留学</th>
                                            <th>主要职责</th>
                                            <th>操作</th>
                                        </tr>
                                        {
                                           this.state.team.map((item,index)=>{
                                                return <tr>
                                                            <td>{item.name}</td>
                                                            <td>{item.position}</td>
                                                            <td>{item.mobile}</td>
                                                            <td>{item.education}</td>
                                                            <td>{item.age}</td>
                                                            <td>{item.shares}</td>
                                                            <td>{item.email}</td>
                                                            <td>{item.study === 1?"是":"否"}</td>
                                                            <td>{item.duty}</td>
                                                            <td>
                                                                <div className="options">
                                                                    <div className="option" onClick={()=>{this.gotoEdit(index)}}>
                                                                        <img alt="" src="assets/imgs/bianji.png" />
                                                                        <p>编辑</p>
                                                                    </div>
                                                                    <div className="option" onClick={()=>{this.gotoDel(index)}}>
                                                                        <img alt="" src="assets/imgs/shanchu.png" />
                                                                        <h2>删除</h2>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                            })
                                        }
                                        
                                    </tbody>
                                </table>

                                <div className="sname">
                                    <div></div>
                                    <p>人才结构数量</p>
                                </div>

                                <div className="sbox">
                                    {
                                        this.state.teamArry.map((item,index)=>{
                                            return <div className="sitem">
                                                    <p>{item.label}</p>
                                                    <input className="s_input" type="text" placeholder="" value={item.value} onChange={(ev)=>{this.changeTeamValue(ev,index)}} />
                                                </div>
                                        })
                                    }
                                </div>

                            </div>
                        </div>
                        
                    </div>

                    <div className="cen">
                        <div className="smain">
                            <div className="sbtns">
                                <div className="btn1" hidden={this.state.aIndex === 0} onClick={()=>{this.gotoPrev(1)}}>上一步</div>
                                {/* <div className="btn1" onClick={()=>{this.saveData(0)}}>保存</div> */}
                                <div className="btn2" onClick={()=>{this.gotoNext(2)}}>{this.state.aIndex !== this.state.arr.length -1?"下一步":"提交"}</div>
                            </div>
                        </div>
                    </div>
                    </div>

                <div className="alert" hidden={!this.state.alert}>
                    <div className="abox">
                        <h1>手机验证</h1>
                        <p>为了工作人员可以及时的和您取得联系</p>
                        <p>请填写正确的手机号码，感谢您的理解和支持</p>
                        <div className="adiv">
                            <div className="aitem">
                                <h2>手机号</h2>
                                <input className="aipt" type="text" placeholder="" value={this.state.data.mobile} onChange={(ev)=>{this.changeDataValue(ev,'mobile')}} />
                            </div>
                            <div className="aitem">
                                <h2>验证码</h2>
                                <div className="asend">
                                    <input type="text" placeholder="" value={this.state.code} onChange={(ev)=>{this.setState({code:ev.target.value})}} />
                                    <button onClick={()=>{this.gotoSend()}} className={this.state.isSend?"bbb":""}>{this.state.isSend?this.state.countDownNum+"s 后重发":"获取验证码"}</button>
                                </div>
                            </div>
                            <div className="amsg">
                                <h2 hidden={!this.state.showMsg}>{this.state.msg}</h2>
                            </div>
                            <div className="abtns">
                                <button className="abtn1" onClick={()=>{this.setState({alert:false})}}>取消</button>
                                <button className="abtn2" onClick={()=>{this.gotoCheck()}}>确定</button>
                            </div>
                        </div>
                    </div>
                </div>

                <div className="alert" hidden={!this.state.sAlert}>
                    <div className="asuccess">
                        <div className="cen">
                            <img alt="" src="assets/imgs/wancheng.png" />
                        </div>
                        <p>提交成功</p>
                        <p>我们会第一时间审核您的报名申请</p>
                        <p>并安排专人与您联系沟通</p>
                        <button onClick={()=>{this.setState({sAlert:false});remove('data');this.gotoPage('/')}}>好的，回到首页</button>
                    </div>
                </div>

                <div className='alert2' hidden={!this.state.showAlert}>
                    <div className='abox'>
                        <div className='cen'>
                            <img alt="" src="assets/imgs/chenggong.png" />
                        </div>
                        <h2>提交成功！</h2>
                        <p>报名已提交成功，等待后台审核</p>
                        <p>您可在“个人中心-我的活动”中查看审核进度</p>
                        <div className='cen'>
                            <button className='btn3' onClick={()=>{window.history.go(-1);}}>好的，知道了</button>
                        </div>
                    </div>
                </div>

                <div className="alert" hidden={!this.state.showSpin}>
                    <div className="aspin">
                        <Spin size="large" tip="上传中..."></Spin>
                    </div>
                </div>

                <Footer />
            </div>
        )
    }
}
